<!-- Inserted RTD Footer -->
{% load i18n %}
<div class="injected">

  {% if not new_theme %}
  <div class="rst-versions rst-badge" data-toggle="rst-versions">
    <span class="rst-current-version" data-toggle="rst-current-version">
      <span class="fa fa-book">&nbsp;</span>
      v: {{ current_version }}
      <span class="fa fa-caret-down"></span>
    </span>
    <div class="rst-other-versions">
      {% endif %}

      {% block versions %}
      {% if translations %}
      <dl>
        <dt>{% trans "Languages" %}</dt>

        {# Output the main project language since it isn't included in translations list #}
        {% if main_project.language == current_language %} <strong> {% endif %}
        <dd><a href="{{ main_project.get_docs_url }}{{ path }}">{{ main_project.language }}</a></dd>
        {% if main_project.language == current_language %} </strong> {% endif %}

        {# regroup to make language_list unique per language #}
        {% regroup translations by language as language_list %}
        {% for group in language_list %}
        {% for translation in group.list %}
        {% if translation.language != main_project.language %}
        {% if translation.language == current_language %} <strong> {% endif %}
        <dd><a href="{{ translation.get_docs_url }}{{ path }}">{{ translation.language }}</a></dd>
        {% if translation.language == current_language %} </strong> {% endif %}
        {% endif %}
        {% endfor %}
        {% endfor %}

      </dl>
      {% endif %}
      {% if not project.single_version and versions|length >= 1 %}
      <dl>
        <dt>{% trans "Versions" %}</dt>
        {% for version in versions %}
        {% if version.verbose_name == current_version %} <strong> {% endif %}
        <dd><a href="{{ version.get_subdomain_url }}{{ path|default_if_none:"" }}">{{ version.slug }}</a></dd>
        {% if version.verbose_name == current_version %} </strong> {% endif %}
        {% endfor %}
      </dl>
      {% endif %}
      {% endblock %}

      {% block downloads %}
      {% if downloads %}
      <dl>
        <dt>{% trans "Downloads" %}</dt>
        {% for name, url in downloads.items %}
        <dd><a href="{{ url }}">{{ name }}</a></dd>
        {% endfor %}
      </dl>
      {% endif %}
      {% endblock %}

      {% block readthedocs %}
      <dl>
        <!-- These are kept as relative links for internal installs that are http -->
        <dt>{% trans "On Read the Docs" %}</dt>
        <dd>
          <a href="//{{ settings.PRODUCTION_DOMAIN }}{% url 'projects_detail' project.slug %}">{% trans "Project Home" %}</a>
        </dd>
        <dd>
          <a href="//{{ settings.PRODUCTION_DOMAIN }}{% url 'builds_project_list' project.slug %}">{% trans "Builds" %}</a>
        </dd>
        <dd>
          <a href="//{{ settings.PRODUCTION_DOMAIN }}{% url 'project_downloads' project.slug %}">{% trans "Downloads" %}</a>
        </dd>
      </dl>
      {% endblock %}

      {% block vcs %}

      {% if github_edit_url %}
      <dl>
        <dt>{% trans "On GitHub" %}</dt>
        <dd>
          <a href="{{ github_view_url }}">{% trans "View" %}</a>
        </dd>
        {% if version.is_editable %}
        <dd>
          <a href="{{ github_edit_url }}">{% trans "Edit" %}</a>
        </dd>
        {% endif %}
      </dl>
      {% elif bitbucket_url %}
      <dl>
        <dt>{% trans "On Bitbucket" %}</dt>
        <dd>
          <a href="{{ bitbucket_url }}">{% trans "Edit" %}</a>
        </dd>
      </dl>
      {% elif gitlab_edit_url %}
      <dl>
        <dt>{% trans "On GitLab" %}</dt>
        <dd>
          <a href="{{ gitlab_view_url }}">{% trans "View" %}</a>
        </dd>
        {% if version.is_editable %}
        <dd>
          <a href="{{ gitlab_edit_url }}">{% trans "Edit" %}</a>
        </dd>
        {% endif %}
      </dl>
      {% endif %}
      {% endblock %}

      {% block search %}
      <dl>
        <dt>{% trans "Search" %}</dt>
        <dd>
          <div style="padding: 6px;">
            <form id="flyout-search-form" class="wy-form" target="_blank" action="//{{ settings.PRODUCTION_DOMAIN }}{% url 'elastic_project_search' project.slug %}" method="get">
              <input type="text" name="q" placeholder="{% trans "Search docs" %}">
              </form>
          </div>
        </dd>
      </dl>
      {% endblock %}



      <hr/>
      {% block footer %}
        <small>
          <span>{% trans "Hosted by" %} <a href="https://readthedocs.org">Read the Docs</a></span>
          <span> &middot; </span>
          <a href="https://docs.readthedocs.io/page/privacy-policy.html">{% trans "Privacy Policy" %}</a>
        </small>
      {% endblock %}

      {% if not new_theme %}
    </div>
  </div>
  {% endif %}

</div>
